home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998…tember: Reference Library / Dev.CD Sep 98 RL2.toast / What's New / Software Development Kits / MacOS USB DDK / Examples / PrinterClassDriver / ChooserPACK.r < prev    next >
Encoding:
Text File  |  1998-07-20  |  9.4 KB  |  338 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ChooserPACK.r
  3.  
  4.     Contains:    Rsrc description to build the PACK header and other rsrcs
  5.                 needed by the PACK code
  6.  
  7.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  8.  
  9. */
  10.  
  11. /***********************************************************************************/
  12. /****  Includes                                                                    ****/
  13. /***********************************************************************************/
  14. #ifndef __CHOOSERPACK__
  15. #define __CHOOSERPACK__
  16.  
  17. #ifndef __COMMON__
  18. #include "Common.h"
  19. #endif
  20.  
  21. #ifndef __SYSTYPES_R__
  22. #include "Types.r"                /* To get system types */
  23. #endif
  24.  
  25. #ifndef __SYSTYPES_R__
  26. #include "SysTypes.r"
  27. #endif
  28.  
  29. /***********************************************************************************/
  30. /****  PACK                                                                        ****/
  31. /***********************************************************************************/
  32. /*
  33.  * When building a PACK resource, insert the line:
  34.  *
  35.  *        type 'PACK' as 'PACW';
  36.  *
  37.  * in your resource file before your "resource 'PACK' ..." declaration.
  38.  */
  39.  
  40. type 'PACW' {
  41.     unsigned integer    = $600e;        /* bra.s to offset $e        */
  42.     unsigned integer    = 0;            /* device ID (Usually 0)    */
  43.     literal longint        = 'PACK';        /* res type, always PACK    */
  44.     integer                = kPACKID;        /* res ID always -4096        */
  45.     integer;                            /* version of driver        */
  46.  
  47.     /*
  48.     Values for flags obtained from Chooser source code file RDEVEqu.a and
  49.     IM Devices, pp 1-46…
  50.     */
  51.     boolean notAppleTalkDev,        appleTalkDev;        /* 31:Appletalk device?        */
  52.     boolean notPAPDev,                papDev;                /* 30:Printer Access Protocol device? */
  53.     boolean notPostScriptDev,        postScriptDev;        /* 29:PostScript device?        */
  54.     boolean noMultiples,            multiples;            /* 28:multiple selections?        */
  55.     boolean noLeftButton,            leftButton;            /* 27:uses left button            */
  56.     boolean noRightButton,            rightButton;        /* 26:uses right button        */
  57.     boolean saveZone,                dontSaveZone;        /* 25:saved zone name            */
  58.     boolean doesntUseZones,            usesZones;            /* 24:uses zone names name        */
  59.     boolean intlChars,                noIntlChars;        /* 23:Translate int'l chars to U.S.? */
  60.     boolean noEvenName,                evenName;            /* 22:Is this a LaserWriter? */
  61.     boolean noLengthOnRename,        lengthOnRename;        /* 21:Pass length byte in Rename name? */
  62.     boolean noOnOff,                onOff;                /* 20:Device uses on/off radio buttons. */
  63.     boolean selfSend,                dontSelfSend;        /* 19:Receive info from this machine? */
  64.     boolean = 0;                                        /* 18:reserved                    */
  65.     boolean doesntAcceptInit,        acceptsInit;        /* 17:accepts Initialize msg    */
  66.     boolean doesntAcceptNewSel,        acceptsNewSel;        /* 16:accepts newSel msg        */
  67.     boolean doesntAcceptFillList,    acceptsFillList;    /* 15:accepts FillList msg        */
  68.     boolean doesntAcceptGetSel,        acceptsGetSel;        /* 14:accepts GetSel msg        */
  69.     boolean doesntAcceptSelect,        acceptsSelect;        /* 13:accepts Select msg        */
  70.     boolean doesntAcceptDeselect,    acceptsDeselect;    /* 12:accepts Deselect msg        */
  71.     boolean doesntAcceptTerm,        acceptsTerm;        /* 11:accepts Terminate msg        */
  72.     boolean doesntAcceptRename,        acceptsRename;        /* 10:accepts Rename msg        */
  73.     boolean = 0;                                        /*  9:reserved                    */
  74.     boolean = 0;                                        /*  8:reserved                    */
  75.     boolean = 0;                                        /*  7:reserved                    */
  76.     boolean = 0;                                        /*  6:reserved                    */
  77.     boolean = 0;                                        /*  5:reserved                    */
  78.     boolean = 0;                                        /*  4:reserved                    */
  79.     boolean = 0;                                        /*  3:reserved                    */
  80.     boolean = 0;                                        /*  2:reserved                    */
  81.     boolean = 0;                                        /*  1:reserved                    */
  82.     boolean packExists,                noPackage;            /*  0:Is the Package really there? */
  83.  
  84.     /*
  85.     The PACK code is inserted here by Rez. Use the $$Resource() directive…
  86.     */
  87.     hex string;
  88. };
  89.  
  90. type 'CTYP' {
  91.     unsigned integer    = 0;        /* type of connection for selected printer 0-none 1-serial 2-UBB */
  92.     unsigned integer doesntSupportSerial,        supportsSerial;
  93.     unsigned integer doesntSupportUSB,            supportsUSB;
  94. };
  95.  
  96. /*
  97. *    What connection types we support and the type of connection for the selected printer
  98. */
  99. resource 'CTYP'(1000, purgeable ) {
  100.     supportsSerial,
  101.     supportsUSB
  102. };
  103.  
  104. /*
  105. *    Path in name registry for the printer models this driver supports
  106. */
  107. resource 'STR#'(1000, purgeable ) {
  108.     {
  109.     "Devices:device-tree:PRINTER:Color StyleWriter 6500",
  110.     "Devices:device-tree:PRINTER:DeskJet 870C",
  111.     }
  112. };
  113.  
  114. /*
  115. *    Path in name registry for the last selected usb printer
  116. *    The code should not change the size of the rsrcs. 
  117. *    Therefore this rsrc must be kepted at a fixed length 
  118. *    size of 256 bytes!
  119. */
  120.  
  121. data 'STR ' (2000, purgeable) {
  122.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  123.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  124.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  125.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  126.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  127.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  128.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  129.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  130.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  131.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  132.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  133.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  134.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  135.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  136.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  137.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  138. };
  139.  
  140. /*
  141. *    Name of last selected usb printer
  142. *    The code should not change the size of the rsrcs. 
  143. *    Therefore this rsrc must be kepted at a fixed length 
  144. *    size of 256 bytes!
  145. */
  146.  
  147. data 'STR ' (2100, purgeable) {
  148.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  149.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  150.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  151.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  152.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  153.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  154.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  155.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  156.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  157.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  158.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  159.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  160.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  161.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  162.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  163.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  164. };
  165.  
  166. /*
  167. *    Color table for no Name Registry alert dialog
  168. */
  169. resource 'actb' (3000) {
  170.     {    /* array ColorSpec: 5 elements */
  171.         /* [1] */
  172.         wContentColor, 65535, 65535, 65535,
  173.         /* [2] */
  174.         wFrameColor, 0, 0, 0,
  175.         /* [3] */
  176.         wTextColor, 0, 0, 0,
  177.         /* [4] */
  178.         wHiliteColor, 0, 0, 0,
  179.         /* [5] */
  180.         wTitleBarColor, 65535, 65535, 65535
  181.     }
  182. };
  183.  
  184. /*
  185. *    Alert used when Name Registry isnt present
  186. */
  187. resource 'ALRT' (3000) {
  188.     {50, 30, 180, 430},
  189.     3000,
  190.     {    /* array: 4 elements */
  191.         /* [1] */
  192.         OK, visible, sound1,
  193.         /* [2] */
  194.         OK, visible, sound1,
  195.         /* [3] */
  196.         OK, visible, sound1,
  197.         /* [4] */
  198.         OK, visible, sound1
  199.     }
  200.     ,alertPositionMainScreen
  201. };
  202.  
  203. /*
  204. *    DITL for alert
  205. */
  206. resource 'DITL' (3000) {
  207.     {    /* array DITLarray: 2 elements */
  208.         /* [1] */
  209.         {97, 313, 117, 387},
  210.         Button {
  211.             enabled,
  212.             "OK"
  213.         },
  214.         /* [2] */
  215.         {13, 74, 84, 387},
  216.         StaticText {
  217.             disabled,
  218.             "The Name Registry is missing from this c"
  219.             "omputer. It is required by this driver t"
  220.             "o function properly."
  221.         }
  222.     }
  223. };
  224.  
  225. /*
  226. *    Color table for printer not available alert dialog
  227. */
  228. resource 'actb' (3100) {
  229.     {    /* array ColorSpec: 5 elements */
  230.         /* [1] */
  231.         wContentColor, 65535, 65535, 65535,
  232.         /* [2] */
  233.         wFrameColor, 0, 0, 0,
  234.         /* [3] */
  235.         wTextColor, 0, 0, 0,
  236.         /* [4] */
  237.         wHiliteColor, 0, 0, 0,
  238.         /* [5] */
  239.         wTitleBarColor, 65535, 65535, 65535
  240.     }
  241. };
  242.  
  243. /*
  244. *    Alert used when Name Registry isnt present
  245. */
  246. resource 'ALRT' (3100) {
  247.     {50, 30, 180, 430},
  248.     3100,
  249.     {    /* array: 4 elements */
  250.         /* [1] */
  251.         OK, visible, sound1,
  252.         /* [2] */
  253.         OK, visible, sound1,
  254.         /* [3] */
  255.         OK, visible, sound1,
  256.         /* [4] */
  257.         OK, visible, sound1
  258.     }
  259.     ,alertPositionMainScreen
  260. };
  261.  
  262. /*
  263. *    DITL for alert
  264. */
  265. resource 'DITL' (3100) {
  266.     {    /* array DITLarray: 2 elements */
  267.         /* [1] */
  268.         {97, 313, 117, 387},
  269.         Button {
  270.             enabled,
  271.             "OK"
  272.         },
  273.         /* [2] */
  274.         {13, 74, 84, 387},
  275.         StaticText {
  276.             disabled,
  277.             "The previously selected printer cannot b"
  278.             "e found. Please make sure the printer is"
  279.             " on, check the connections or make anoth"
  280.             "er selection."
  281.         }
  282.     }
  283. };
  284.  
  285.  
  286. /*
  287.  * This will produce a PACK resource from the special PACW type.
  288.  * (this eliminates the need for using the Assembler to create
  289.  *    the DA header, but makes it impossible to use SADE, oops!)
  290.  *
  291.  */
  292.  
  293. type 'PACK' as 'PACW';            /* Map 'PACW' => 'PACK' */
  294.  
  295. resource 'PACK' (kPACKID, purgeable) {
  296.     /*
  297.      * device version
  298.      */
  299.     3,
  300.     
  301.     /*
  302.      * PACK flags
  303.      */
  304.     notAppleTalkDev,        /* non appletalk device            */
  305.     notPAPDev,                /* non PAP device                */
  306.     notPostScriptDev,        /* non PostScript device        */
  307.     noMultiples,            /* multiple instances            */
  308.     noLeftButton,            /* use left button                */
  309.     noRightButton,            /* use right button                */
  310.     dontSaveZone,            /* save zone name                */
  311.     doesntUseZones,            /* uses zone names name            */
  312.     intlChars,                /* let international chars through */
  313.     noEvenName,                /* not a LaserWriter; leave the name alone */
  314.     noLengthOnRename,        /* don't send the length byte with the name */
  315.     noOnOff,                /* doesn't use on/off button    */
  316.     selfSend,                /* not really relevant            */
  317.     acceptsInit,            /* Accepts the Initialize msg    */
  318.     doesntAcceptNewSel,        /* no newSel msg                */
  319.     acceptsFillList,        /* FillList msg                    */
  320.     acceptsGetSel,            /* accepts GetSel msg            */
  321.     acceptsSelect,            /* accepts Select msg            */
  322.     acceptsDeselect,        /* Deselect msg                    */
  323.     acceptsTerm,            /* accept Terminate msg            */
  324.     doesntAcceptRename,        /* doesn't accept rename msg    */
  325.     packExists,                /* package really exists        */
  326.  
  327.     /*
  328.      * This directive inserts the contents of the PACW resource
  329.      * with our PACK code
  330.      */
  331.     #ifdef __MPW__
  332.         $$Resource("::ChsrPACW.rsrc", 'PACW', 0)
  333.     #else
  334.         $$Resource("ChsrPACW.rsrc", 'PACW', 0)
  335.     #endif
  336. };
  337.  
  338. #endif